home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ADA Programming Guide
/
ADA Programming Guide.iso
/
ada_pcdp
/
ada
/
pca.ada
< prev
next >
Wrap
Text File
|
1996-01-30
|
893b
|
49 lines
with Text_IO; use Text_IO;
with Buffer_Package; use Buffer_Package;
procedure PCA is
B: Buffer;
task Producer is
pragma Priority(10);
end Producer;
task Consumer1 is
pragma Priority(7);
end Consumer1;
task Consumer2 is
pragma Priority(7);
end Consumer2;
task body Producer is
N: Integer := 0;
begin
loop
N := N + 1;
Put_Line("Produce " & Integer'Image(N));
if N mod 40 = 0 then delay 1.0; end if;
Append(B, N);
end loop;
end Producer;
task body Consumer1 is
N: Integer;
begin
loop
Take(B, N);
Put_Line("Consume 1 " & Integer'Image(N));
end loop;
end Consumer1;
task body Consumer2 is
N: Integer;
begin
loop
Take(B, N);
Put_Line("Consume 2 " & Integer'Image(N));
end loop;
end Consumer2;
begin
null;
end PCA;